#图书馆存有密码及书籍
users={'user1':'123456','user2':'12345678'}
books_in=['斗破苍穹','我与地坛','论持久战']
book_out=['人文与沟通','高等数学','陶喆合集']
user_book={'user1':['圣墟'],'user2':['人生']}
#用户登录
while True:
    user_name=input('请输入用户名')
    user_key=input('请输入密码')
    #用户操作
    if users[user_name]==user_key:
        print('登录成功')
        print('请选择你的操作')
        print('1.修改密码')
        print('2.借书')
        print('3，还书')
        print('4.查询记录')
        choice=input()
        if choice=='1':
            print('请输入你的新密码')
            changed_key=input()
            users['user1']=changed_key
            print('修改成功')
            print(user_name)
        if choice=='2':
            print('图书馆现存有书籍')

            print(books_in)
            print('请输入你要借阅的书籍')
            book_borrowed=input()

            if book_borrowed in books_in:

                books_in.remove(book_borrowed)
                book_out.append(book_borrowed)
                user_book[user_name].append(book_borrowed)
                print('借书成功')
            else:
                print("你查询的书籍暂未收录")
        if choice=='3':
            print('图书馆现以借出的书籍')
            print(book_out)
            print('请输入你要归还的书籍')
            book_returned=input()

            if book_returned in book_out:
                book_out.remove(book_returned)
                books_in.append(book_returned)
                user_book[user_name].remove(book_returned)
                print('归还成功')
            else:
                print('归还失败')
        if choice=='4':
            print('图书馆现有书籍')
            print(books_in)
            print('图书馆借出书籍')
            print(book_out)
            print('您当前借阅的书籍')
            print(user_book[user_name])
    else:
        print('密码错误')
